local sk__jiaomei = fk.CreateSkill {

  name = "sk__jiaomei",

  tags = {  },

}



sk__jiaomei:addEffect(fk.TargetSpecified, {
  name = "sk__jiaomei",
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__jiaomei.name) and (data.card.trueName == "slash" or data.card.type == Card.TypeTrick) and
      player.phase == Player.Play and player:usedSkillTimes(sk__jiaomei.name, Player.HistoryPhase) == 0 and
      table.find(data:getAllTargets(), function (id)
        return not id.dead
      end)
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, sk__jiaomei.name, nil, "#sk__jiaomei-invoke")
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:doIndicate(player.id, data:getAllTargets())
    for _, id in ipairs(data:getAllTargets()) do
      local p = id
      if not p.dead then
        if not p.chained then
          p:setChainState(true)
        else
          p:setChainState(false)
          if not p.dead then
            p:turnOver()
          end
        end
      end
    end
  end,
})

return sk__jiaomei